package com.shaobufan.museum.controllar;

import com.shaobufan.museum.common.BaseResponse;
import com.shaobufan.museum.common.ResultUtils;
import com.shaobufan.museum.pojo.entity.Mission;
import com.shaobufan.museum.pojo.entity.Notice;
import com.shaobufan.museum.pojo.request.mission.MissionAddRequest;
import com.shaobufan.museum.pojo.request.notice.interior.NoticeAddRequest;
import com.shaobufan.museum.service.MissionService;
import com.shaobufan.museum.service.NoticeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公告请求
 */
@RestController
@RequestMapping("/mission")
public class MissionController {
    @Resource
    MissionService missionService;

    @ApiOperation("获取部门通知")
    @GetMapping("/get/{params}")
    public BaseResponse<List<Mission>> getMission(@PathVariable Integer params) {
        List<Mission> missionList = missionService.getMission(params);
        return ResultUtils.success(missionList, "部门任务");
    }

    @ApiOperation("添加任务")
    @PostMapping("/add")
    public BaseResponse<Boolean> addNotice(@RequestBody MissionAddRequest missionAddRequest) {
        Boolean added = missionService.addMission(missionAddRequest);
        return ResultUtils.success(added, "添加成功");
    }
}